package collection;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class MyCollection {
    private String first,last;
    MyCollection(String first,String last){
        this.first=first;
        this.last=last;
    }

    @Override
    public boolean equals(Object obj) {
        MyCollection collection= (MyCollection) obj;
        return collection.first.equals(first) && collection.last.equals(last);
    }

    public static void main(String[] args) {
        Set s=new HashSet<String>();
        s.add(new MyCollection("hh","aa"));
        System.out.println(s.contains(new MyCollection("hh","aa")));

        List list=new ArrayList<String>();
        list.add(new MyCollection("hh","aa"));
        System.out.println(list.contains(new MyCollection("hh","aa")));
    }
}
